package com.example.backadmindemo.service.impl;

import com.example.backadmindemo.mapper.IObehaveMapper;
import com.example.backadmindemo.pojo.IObehave;
import com.example.backadmindemo.service.IObehaveService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class IObehaveServiceImpl implements IObehaveService {

    @Resource
    private IObehaveMapper iObehaveMapper;

    @Override
    public List<IObehave> selectIn(int currentPage, int pageSize) {
        Map<String, Object> map = new HashMap<>();
        int startCurrentPage = (currentPage - 1) * pageSize;
        map.put("currentPage", startCurrentPage);
        map.put("pageSize", pageSize);
        return iObehaveMapper.selectIn(map);
    }

    @Override
    public List<IObehave> selectOut(int currentPage, int pageSize) {
        Map<String, Object> map = new HashMap<>();
        int startCurrentPage = (currentPage - 1) * pageSize;
        map.put("currentPage", startCurrentPage);
        map.put("pageSize", pageSize);
        return iObehaveMapper.selectOut(map);
    }

    @Override
    public Integer getInTotal() {
        return iObehaveMapper.getInTotal();
    }

    @Override
    public Integer getOutTotal() {
        return iObehaveMapper.getOutTotal();
    }
}
